﻿// =================================================================== 
// 项目说明
//====================================================================
// lsc @Copy Right 2020
// 文件： CallEndRepository.cs
// 项目名称：斑马车务
// 创建时间：2020-02-13
// 负责人：lsc
// ===================================================================
using System;
using System.Text;
using System.Collections.Generic;
using CRM.Infrastructure.Entity;
using Dapper;

namespace CRM.Infrastructure.Repository
{
    /// <summary>
    /// 仓储层
    /// </summary>	
    public class CallEndRepository : BaseRepository<CallEnd>
    {

        #region 构造

        public CallEndRepository() : base() { }

        public CallEndRepository(string connectionString) : base(connectionString) { }

        public CallEndRepository(DatabaseContext dbContext) : base(dbContext) { }

        #endregion

        public List<CallEnd> GetCallEndInfoBySubID(int companyId,string subID)
        {
            string szSql = @" select 
	 * 
 from CallEnd c
 where 1=1 
 and SubID=@SubID
 AND CompanyID=@CompanyID
 order by EndTime desc";
            return Query(szSql, new { SubID = subID, CompanyID = companyId });
        }




        /// <summary>
        /// 根据线索获取通话详情
        /// </summary>
        /// <param name="clueId"></param>
        /// <returns></returns>
        public List<CallEnd> GetCallEndsByClue(int clueId)
        {
            string sql = "SELECT * FROM [CallEnd] WHERE ClueID=" + clueId;
            return Query(sql);
        }
    }
}